<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Lucky Time</title>
        <link rel="preload" href="images/bg.webp" as="image" />
        <link rel="preload" href="images/10001.png" as="image" /> <!-- 预加载加载图像 -->
        <script src="config/config.js" defer></script> <!-- 使用defer属性，保证DOM加载完成后再执行 -->
        <style>
            html, body {
                height: 100%;
                margin: 0;
                box-sizing: border-box;
                -moz-osx-font-smoothing: grayscale;
                -webkit-font-smoothing: antialiased;
                text-rendering: optimizeLegibility;
            }
            #appLoading {
                position: fixed;    
                top: 0;
                left: 0;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                height: 100%;
                width: 100%;
                background: #ffffff;
                z-index: 99;
            }
            img.loadingBox {
                width: 13.18vw;
                height: 13.18vw;
                animation: shake 0.4s ease-in-out infinite alternate; 
            }
            .loading {
                font-size: 4.71vw;
                margin-top: 2.35vw;
                color: #cccccc;
            }
            @keyframes shake {
                0% { transform: rotate(0deg); }
                20% { transform: rotate(-6deg); }
                40% { transform: rotate(6deg); }
                50%, 80%, 100% { transform: rotate(0deg); }
            }
            #app {
                height: 100%;
                background-image: none;
                background-repeat: no-repeat;
                background-size: 100% 100%;
            }
        </style>
    </head>
    <body>
        <div id="appLoading">
            <img src="images/10001.png" alt="Loading image" class="loadingBox" />
            <div class="loading">Loading<span class="dots"></span></div>
        </div>
        <div id="app"></div>
        <script>
            // 懒加载背景图像
            window.addEventListener('load', function() {
                const app = document.getElementById('app');
                app.style.backgroundImage = "url('images/bg.webp')";
                app.style.transition = "background-image 0.5s ease";
                const loading = document.getElementById('appLoading');
                loading.style.display = 'none';
            });
        </script>
    </body>
    
</html>
